﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enterprise.Infrastructure;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Enterprise.Model.WorkFlow;
using Enterprise.DataFactory;
namespace Enterprise.Data.WorkFlow
{
    /// <summary>
    ///  流程类型数据表操作类
    /// </summary>
   public class WorkFlowInfoData
    {
        /// <summary>
        ///  用户数据列表
        /// </summary>
        /// <returns></returns>
        public List<WorkFlowInfoEntity> WorkFlowList()
        {
            List<WorkFlowInfoEntity> list = new List<WorkFlowInfoEntity>();
            string cmd = "Select * from SYS_WORKFLOW";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                WorkFlowInfoEntity entity = new WorkFlowInfoEntity();
                if (!Convert.IsDBNull(dr["WFID"])) entity.WFID = Convert.ToInt32(dr["WFID"]);
                if (!Convert.IsDBNull(dr["WFNAME"])) entity.WFNAME = Convert.ToString(dr["WFNAME"]);
                if (!Convert.IsDBNull(dr["WFVERSION"])) entity.WFVERSION = Convert.ToInt32(dr["WFVERSION"]);
                if (!Convert.IsDBNull(dr["WFTYPE"])) entity.WFTYPE = Convert.ToString(dr["WFTYPE"]);
                if (!Convert.IsDBNull(dr["WFREMARK"])) entity.WFREMARK = Convert.ToString(dr["WFREMARK"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 流程数据操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void WorkFlowExecute(string cmd)
        {
            DbExecute.Execute(cmd);
        }

        /// <summary>
        /// 返回数据集合
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        public DataSet ExcuteDataSet(string cmd)
        {
            return DbExecute.GetDataSet(cmd);
        }
    }
}
